Skip to content

Conversation

@timotheeguerin
Copy link
Member

@timotheeguerin timotheeguerin commented Nov 26, 2025

fix #8669

TODO:

  • Developper docs
  • resolve how to define


/** Validator implementation. This function will be run according to the kind defined above. */
readonly validator: () => readonly Diagnostic[];
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open to suggestion on the property names, the union values as well as a good way to have a oneliner function to build this object

// 1
const myDec: MyDecDecorator = (contex, target) => {
  return context.validate.postSelf(() => {
    // ....
  })
}

// 2
const myDec: MyDecDecorator = (contex, target) => {
  return DecoratorPostValidator.postSelf(() => {
    // ....
  })
}

// 3
const myDec: MyDecDecorator = (contex, target) => {
  return postSelf(() => {
    // ....
  })
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current name suggestions "onFinish" | "onGraphFinish"

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 26, 2025

Open in StackBlitz

@typespec/compiler

npm i https://pkg.pr.new/microsoft/typespec/@typespec/compiler@9104

@typespec/events

npm i https://pkg.pr.new/microsoft/typespec/@typespec/events@9104

@typespec/http

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http@9104

@typespec/http-client

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client@9104

@typespec/json-schema

npm i https://pkg.pr.new/microsoft/typespec/@typespec/json-schema@9104

@typespec/openapi

npm i https://pkg.pr.new/microsoft/typespec/@typespec/openapi@9104

@typespec/openapi3

npm i https://pkg.pr.new/microsoft/typespec/@typespec/openapi3@9104

@typespec/protobuf

npm i https://pkg.pr.new/microsoft/typespec/@typespec/protobuf@9104

@typespec/rest

npm i https://pkg.pr.new/microsoft/typespec/@typespec/rest@9104

@typespec/spector

npm i https://pkg.pr.new/microsoft/typespec/@typespec/spector@9104

@typespec/sse

npm i https://pkg.pr.new/microsoft/typespec/@typespec/sse@9104

@typespec/streams

npm i https://pkg.pr.new/microsoft/typespec/@typespec/streams@9104

@typespec/tspd

npm i https://pkg.pr.new/microsoft/typespec/@typespec/tspd@9104

@typespec/versioning

npm i https://pkg.pr.new/microsoft/typespec/@typespec/versioning@9104

@typespec/xml

npm i https://pkg.pr.new/microsoft/typespec/@typespec/xml@9104

commit: e428f17

@github-actions
Copy link
Contributor

github-actions bot commented Nov 26, 2025

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @typespec/compiler

The following packages have already been documented:

  • @typespec/events
  • @typespec/http-client
  • @typespec/http
  • @typespec/json-schema
  • @typespec/openapi
  • @typespec/openapi3
  • @typespec/protobuf
  • @typespec/rest
  • @typespec/spector
  • @typespec/sse
  • @typespec/streams
  • @typespec/tspd
  • @typespec/versioning
  • @typespec/xml
Show changes

@typespec/events - internal ✏️

Regenerate signature

@typespec/http-client - internal ✏️

Regenerate signature

@typespec/http - internal ✏️

Regenerate signature

@typespec/json-schema - internal ✏️

Regenerate signature

@typespec/openapi - internal ✏️

Regenerate signature

@typespec/openapi3 - internal ✏️

Regenerate signature

@typespec/protobuf - internal ✏️

Regenerate signature

@typespec/rest - internal ✏️

Regenerate signature

@typespec/spector - internal ✏️

Regenerate signature

@typespec/sse - internal ✏️

Regenerate signature

@typespec/streams - internal ✏️

Regenerate signature

@typespec/tspd - internal ✏️

Regenerate signature

@typespec/versioning - internal ✏️

Regenerate signature

@typespec/xml - internal ✏️

Regenerate signature

readonly kind: "postSelf" | "post";

/** Validator implementation. This function will be run according to the kind defined above. */
readonly validator: () => readonly Diagnostic[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now have this expecting an array of diagnostic, this feels nicer that always expecting it to be reported to the program but also less consistent with the rest. It also doesn't pervent you from directly reporting to program if you prefer. What do people think?

@azure-sdk
Copy link
Collaborator

azure-sdk commented Nov 26, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability for decorators to register a post check validator

2 participants